import {
	ref,
	watch
} from 'vue';
import {
	useStore
} from "vuex"
export const useTheme = () => {
	const themeName = ref("default")
	const store = useStore()
	const getTheme = (name) => {
		store.state.theme = store.state.theme ? store.state.theme : themeName;
	}

	const changeTheme = (name) => {
		themeName.value = name
		store.state.theme = name
	}

	watch(themeName, (e) => {
		changeTheme(e)
	})



	return {
		themeName,
		getTheme,
		changeTheme
	}
}